home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65c+IDA-1.4.4.1 / S5 / rmail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-17  |  16.5 KB  |  646 lines

  1. *** rmail/rmail.c
  2. --- /tmp/getb7496    Sun Apr  7 16:46:31 1991
  3. ***************
  4. *** 1,3 ****
  5. --- 1,4 ----
  6. + /*    %W%    %G%    %U%    */
  7.   /*
  8.    * Copyright (c) 1981, 1988 The Regents of the University of California.
  9.    * All rights reserved.
  10. ***************
  11. *** 21,32 ****
  12.   char copyright[] =
  13.   "@(#) Copyright (c) 1981, 1988 The Regents of the University of California.\n\
  14.    All rights reserved.\n";
  15.   #endif /* not lint */
  16.   
  17.   #ifndef lint
  18. ! static char sccsid[] = "@(#)rmail.c    4.15 (Berkeley) 5/31/90";
  19.   #endif /* not lint */
  20.   
  21.   /*
  22.    * RMAIL -- UUCP mail server.
  23.    *
  24. --- 22,49 ----
  25.   char copyright[] =
  26.   "@(#) Copyright (c) 1981, 1988 The Regents of the University of California.\n\
  27.    All rights reserved.\n";
  28. + #ifdef    __GNUC__
  29. +     static    char    compiled[] = "@(#)compiled by gcc "__VERSION__;
  30. + #endif
  31.   #endif /* not lint */
  32.   
  33.   #ifndef lint
  34. ! static char sccsid[] = "@(#)rmail.c    4.15 (Berkeley) 5/31/90    %I% local";
  35.   #endif /* not lint */
  36.   
  37. + #ifndef    BSD
  38. + #define    index    strchr
  39. + #define    rindex    strrchr
  40. + #include    <unistd.h>
  41. + #include    <memory.h>
  42. + char    *calloc();    /* should be in malloc.h */
  43. + #include    <string.h>
  44. + #endif
  45. + #ifndef    HAVE_STRDUP
  46. + char    *strdup();
  47. + #endif
  48.   /*
  49.    * RMAIL -- UUCP mail server.
  50.    *
  51. ***************
  52. *** 41,46 ****
  53. --- 58,64 ----
  54.   #include <sys/stat.h>
  55.   #include <stdio.h>
  56.   #include <paths.h>
  57. + #include    <malloc.h>
  58.   
  59.   typedef char bool;
  60.   #define TRUE    1
  61. ***************
  62. *** 48,74 ****
  63.   
  64.   extern char *index();
  65.   extern char *rindex();
  66.   
  67.   char *Domain = "UUCP";        /* Default "Domain" */
  68.   
  69. ! main(argc, argv)
  70.       int argc;
  71.       char **argv;
  72.   {
  73. !     char lbuf[1024];    /* one line of the message */
  74. !     char from[512];        /* accumulated path of sender */
  75. !     char ufrom[512];    /* user on remote system */
  76. !     char sys[512];        /* a system in path */
  77. !     char fsys[512];        /* first system in path */
  78. !     char junk[1024];    /* scratchpad */
  79. !     char *args[100];    /* arguments to mailer command */
  80.       register char *cp;
  81.       register char *uf = NULL;    /* ptr into ufrom */
  82.       int i;
  83. -     long position;
  84.       struct stat sbuf;
  85.   #ifdef DEBUG
  86. !     bool Debug;
  87.   
  88.       if (argc > 1 && strcmp(argv[1], "-T") == 0) {
  89.           Debug = TRUE;
  90. --- 66,111 ----
  91.   
  92.   extern char *index();
  93.   extern char *rindex();
  94. + extern    void    exit();
  95. + extern    int    close();
  96. + extern    int    dup2();
  97. + extern    int    execl();
  98. + extern    int    execv();
  99. + extern    int    fclose();
  100. + extern    int    fork();
  101. + extern    int    fprintf();
  102. + extern    int    fputs();
  103. + extern    int    fstat();
  104. + extern    int    pipe();
  105. + extern    int    printf();
  106. + extern    int    sscanf();
  107. + extern    int    sprintf();
  108. + extern    void    rewind();
  109. + extern    unsigned    sleep();
  110. + char    *xmalloc();
  111. + char    *xrealloc();
  112. + char    *xcalloc();
  113.   
  114.   char *Domain = "UUCP";        /* Default "Domain" */
  115.   
  116. ! int    main(argc, argv)
  117.       int argc;
  118.       char **argv;
  119.   {
  120. !     char *lbuf;    /* one line of the message */
  121. !     char *from;        /* accumulated path of sender */
  122. !     char *ufrom;    /* user on remote system */
  123. !     char *sys;        /* a system in path */
  124. !     char *fsys = NULL;        /* first system in path */
  125. !     char **args;    /* arguments to mailer command */
  126. !     char    *from_lines;    /* beginning of message */
  127.       register char *cp;
  128.       register char *uf = NULL;    /* ptr into ufrom */
  129.       int i;
  130.       struct stat sbuf;
  131.   #ifdef DEBUG
  132. !     bool Debug = FALSE;
  133.   
  134.       if (argc > 1 && strcmp(argv[1], "-T") == 0) {
  135.           Debug = TRUE;
  136. ***************
  137. *** 77,116 ****
  138.       }
  139.   #endif
  140.   
  141.       if (argc < 2) {
  142.           fprintf(stderr, "Usage: rmail user ...\n");
  143.           exit(EX_USAGE);
  144.       }
  145. !     if (argc > 2 && strncmp(argv[1], "-D", 2) == 0) {
  146. !         Domain = &argv[1][2];
  147. !         argc -= 2;
  148. !         argv += 2;
  149. !     }
  150. !     from[0] = '\0';
  151. !     fsys[0] = '\0';
  152. !     (void) strcpy(ufrom, _PATH_DEVNULL);
  153. !     for (position = 0;; position = ftell(stdin)) {
  154. !         if (fgets(lbuf, sizeof lbuf, stdin) == NULL)
  155. !             exit(EX_DATAERR);
  156.           if (strncmp(lbuf, "From ", 5) != 0 &&
  157.               strncmp(lbuf, ">From ", 6) != 0)
  158.               break;
  159. !         (void) sscanf(lbuf, "%s %s", junk, ufrom);
  160. !         cp = lbuf;
  161.           uf = ufrom;
  162. !         for (;;) {
  163. !             cp = index(cp + 1, 'r');
  164. !             if (cp == NULL) {
  165.                   register char *p = rindex(uf, '!');
  166.   
  167. !                 if (p != NULL) {
  168. !                     *p = '\0';
  169. !                     (void) strcpy(sys, uf);
  170. !                     uf = p + 1;
  171.                       break;
  172.                   }
  173. -                 (void) strcpy(sys, "");
  174.                   break;    /* no "remote from" found */
  175.               }
  176.   #ifdef DEBUG
  177. --- 114,191 ----
  178.       }
  179.   #endif
  180.   
  181. +     if (argc > 1 && strncmp(argv[1], "-D", 2) == 0) {
  182. +         Domain = &argv[1][2];
  183. +         argc--;
  184. +         argv++;
  185. +     }
  186.       if (argc < 2) {
  187.           fprintf(stderr, "Usage: rmail user ...\n");
  188.           exit(EX_USAGE);
  189.       }
  190. !     lbuf = (char *)xcalloc(BUFSIZ+1, sizeof(char));
  191. !     from = (char *)xcalloc(1, sizeof(char));
  192. !     from_lines = (char *)xcalloc(1, sizeof(char));
  193. !     sys = (char *)xcalloc(1, sizeof(char));
  194. !     ufrom = strdup(_PATH_DEVNULL);
  195. !     /* read lines starting from the beginning until all the From lines are exhausted */
  196. !     for (;;) {
  197. !         lbuf = (char *)xrealloc(lbuf, BUFSIZ+1);
  198. !         (void) memset(lbuf, '\0', BUFSIZ+1);
  199. !         (void) fgets(lbuf, BUFSIZ, stdin);
  200. !         lbuf = (char *)xrealloc(lbuf, strlen(lbuf)+1);
  201. !         from_lines = (char *)xrealloc(from_lines, strlen(from_lines)+strlen(lbuf)+1);
  202. !         strcat(from_lines, lbuf);    /* save what has already been read */
  203.           if (strncmp(lbuf, "From ", 5) != 0 &&
  204.               strncmp(lbuf, ">From ", 6) != 0)
  205.               break;
  206. ! #ifdef DEBUG
  207. !         if (Debug) /* replace the newline with a nul for pretty printing */
  208. !             if (cp = rindex(lbuf, '\n'))
  209. !                 *cp = '\0';
  210. ! #endif
  211. !         /* put "prev-path" from "From prev-path" in ufrom */
  212. !         ufrom = (char *)xrealloc(ufrom, strlen(lbuf)-4);
  213. !         (void) sscanf(lbuf, "%*s %s", ufrom);
  214. !         ufrom = (char *)xrealloc(ufrom, strlen(ufrom)+1);
  215. !         /* put the path in ! form if it has '@'s or '%'s */
  216. !         /* NB: this doesn't handle RFC822 source routing, deprecated by RFC1123 */
  217. !         /*        It does handle mixed !,%,@ syntax */
  218. !         /* first replace all '%'s with '@'s */
  219. !         for(cp = ufrom; *cp ; cp++)
  220. !             if (*cp == '%')
  221. !                 *cp = '@';
  222. !         /* then move all domains to the front as a bang path, recursively */
  223.           uf = ufrom;
  224. !         while (cp = rindex(uf, '@')) {
  225. !             uf = (char *)xcalloc(strlen(uf)+1, sizeof(char));    /* same size */
  226. !             *cp++ = '\0';    /* cp points to domain; ufrom terminated */
  227. !             (void) sprintf(uf, "%s!%s", cp, ufrom);    /* uf now fixed */
  228. !             free(ufrom);    /* discard old data */
  229. !             ufrom = uf;    /* replace old form with new */
  230. !         }
  231. !         /* done; ufrom=uf points to the path */
  232. !         cp = lbuf+4;    /* start near end of "From " */
  233. !         /* NB: cp points into lbuf; uf into ufrom -- they are distinct strings */
  234. !         for (;;) {    /* look for "remote from" */
  235. !             if ((cp = index(++cp, 'r')) == (char *)NULL) { /* no 'r', no "remote from ..." */
  236.                   register char *p = rindex(uf, '!');
  237.   
  238. !                 if (p != NULL) {    /* last '!' */
  239. !                     *p = '\0';    /* terminate path before user */
  240. !                     sys = (char *)xrealloc(sys, strlen(uf)+1);
  241. !                     (void) strcpy(sys, uf);    /* sys holds leading part of path */
  242. !                     uf = p + 1;    /* uf points to user */
  243.                       break;
  244.                   }
  245.                   break;    /* no "remote from" found */
  246.               }
  247.   #ifdef DEBUG
  248. ***************
  249. *** 117,145 ****
  250.               if (Debug)
  251.                   printf("cp='%s'\n", cp);
  252.   #endif
  253.               if (strncmp(cp, "remote from ", 12) == 0)
  254. !                 break;
  255.           }
  256. !         if (cp != NULL)
  257.               (void) sscanf(cp, "remote from %s", sys);
  258. !         if (fsys[0] == '\0')
  259. !             (void) strcpy(fsys, sys);
  260. !         if (sys[0]) {
  261.               (void) strcat(from, sys);
  262.               (void) strcat(from, "!");
  263.           }
  264.   #ifdef DEBUG
  265.           if (Debug)
  266. !             printf("ufrom='%s', sys='%s', from now '%s'\n", uf, sys, from);
  267.   #endif
  268. !     }
  269.       if (uf == NULL) {    /* No From line was provided */
  270.           fprintf(stderr, "No From line in rmail\n");
  271. !         exit(EX_DATAERR);
  272.       }
  273.       (void) strcat(from, uf);
  274.       (void) fstat(0, &sbuf);
  275. !     (void) lseek(0, position, L_SET);
  276.   
  277.       /*
  278.        * Now we rebuild the argument list and chain to sendmail. Note that
  279. --- 192,241 ----
  280.               if (Debug)
  281.                   printf("cp='%s'\n", cp);
  282.   #endif
  283. +             /* check to see if the 'r' starts "remote from " */
  284.               if (strncmp(cp, "remote from ", 12) == 0)
  285. !                 break; /* we found it. we're outta here. */
  286.           }
  287. !         /* if cp is non-NULL it points to "remote from ..." */
  288. !         if (cp != NULL) {
  289. !             sys = (char *)xrealloc(sys, strlen(cp)-11);
  290.               (void) sscanf(cp, "remote from %s", sys);
  291. !             if (fsys == NULL)
  292. !                 fsys = strdup(sys);    /* sys and fsys hold remote system name */
  293. !         }
  294. !         if (*sys) {    /* write remote system name followed by '!' (first hop in return path) */
  295. !             from = (char *)xrealloc(from, strlen(sys)+strlen(from)+2);
  296.               (void) strcat(from, sys);
  297.               (void) strcat(from, "!");
  298.           }
  299.   #ifdef DEBUG
  300.           if (Debug)
  301. !             printf("ufrom='%s', uf='%s', sys='%s', from now '%s'\n", ufrom, uf, sys, from);
  302.   #endif
  303. !     }    /* no more "From " lines */
  304. !     free(sys);
  305. !     /* from holds the concatenation of the "remote from ..." parts, '!' separated, ends with '!' */
  306. !     /* fsys holds the system name from the FIRST "From ... remote from ..." line */
  307. !     /*        That's the first hop of the return path */
  308. !     /* uf points to the user name from the LAST "From " line */
  309.       if (uf == NULL) {    /* No From line was provided */
  310.           fprintf(stderr, "No From line in rmail\n");
  311. !         /*    exit(EX_DATAERR);    */
  312.       }
  313. +     from = (char *)xrealloc(from, strlen(uf)+strlen(from)+1);
  314.       (void) strcat(from, uf);
  315. + #ifdef DEBUG
  316. +     if (Debug)
  317. +         printf("uf='%s', from now '%s'\n", uf, from);
  318. + #endif
  319.       (void) fstat(0, &sbuf);
  320. !     free(ufrom);
  321.   
  322.       /*
  323.        * Now we rebuild the argument list and chain to sendmail. Note that
  324. ***************
  325. *** 146,174 ****
  326.        * the above lseek might fail on irregular files, but we check for
  327.        * that case below. 
  328.        */
  329.       i = 0;
  330. !     args[i++] = _PATH_SENDMAIL;
  331.       args[i++] = "-oee";        /* no errors, just status */
  332. !     args[i++] = "-odq";        /* queue it, don't try to deliver */
  333.       args[i++] = "-oi";        /* ignore '.' on a line by itself */
  334. !     if (fsys[0] != '\0') {        /* set sender's host name */
  335. !         static char junk2[512];
  336.           if (index(fsys, '.') == NULL) {
  337.               (void) strcat(fsys, ".");
  338.               (void) strcat(fsys, Domain);
  339.           }
  340. !         (void) sprintf(junk2, "-oMs%s", fsys);
  341. !         args[i++] = junk2;
  342.       }
  343. -                     /* set protocol used */
  344. -     (void) sprintf(junk, "-oMr%s", Domain);
  345. -     args[i++] = junk;
  346.       if (from[0] != '\0') {        /* set name of ``from'' person */
  347. !         static char junk2[512];
  348. !         (void) sprintf(junk2, "-f%s", from);
  349. !         args[i++] = junk2;
  350.       }
  351.       for (; *++argv != NULL; i++) {
  352.           /*
  353. --- 242,269 ----
  354.        * the above lseek might fail on irregular files, but we check for
  355.        * that case below. 
  356.        */
  357. +     args = (char **)xcalloc(6, sizeof(char *)); /* start with mailer, flags */
  358.       i = 0;
  359. !     args[i++] = strrchr(_PATH_SENDMAIL, '/')+1;
  360.       args[i++] = "-oee";        /* no errors, just status */
  361. !     args[i++] = "-odb";        /* deliver in background */
  362.       args[i++] = "-oi";        /* ignore '.' on a line by itself */
  363. !     args[i++] = "-oMrUUCP";        /* set protocol used */
  364. !     if (fsys) {        /* set sender's host name */
  365.           if (index(fsys, '.') == NULL) {
  366. +             fsys = (char *) xrealloc(fsys, strlen(fsys)+strlen(Domain)+2);
  367.               (void) strcat(fsys, ".");
  368.               (void) strcat(fsys, Domain);
  369.           }
  370. !         args[i] = (char *)xcalloc(5+strlen(fsys), sizeof(char));
  371. !         (void) sprintf(args[i++], "-oMs%s", fsys);
  372. !         free(fsys);
  373.       }
  374.       if (from[0] != '\0') {        /* set name of ``from'' person */
  375. !         args = (char **)xrealloc((char *)args, (i+1)*sizeof(char *));
  376. !         args[i] = (char *)xcalloc(strlen(from)+3, sizeof(char));
  377. !         (void) sprintf(args[i++], "-f%s", from);
  378. !         free(from);
  379.       }
  380.       for (; *++argv != NULL; i++) {
  381.           /*
  382. ***************
  383. *** 177,185 ****
  384.            * should be fixed in sendmail by using getopt(3), and
  385.            * just passing "--" before regular args.
  386.            */
  387. !         if (**argv != '-')
  388.               args[i] = *argv;
  389.       }
  390.       args[i] = NULL;
  391.   #ifdef DEBUG
  392.       if (Debug) {
  393. --- 272,283 ----
  394.            * should be fixed in sendmail by using getopt(3), and
  395.            * just passing "--" before regular args.
  396.            */
  397. !         if (**argv != '-') {
  398. !             args = (char **)xrealloc((char *)args, (i+1)*sizeof(char *));
  399.               args[i] = *argv;
  400. +         }
  401.       }
  402. +     args = (char **)xrealloc((char *)args, (i+1)*sizeof(char *));
  403.       args[i] = NULL;
  404.   #ifdef DEBUG
  405.       if (Debug) {
  406. ***************
  407. *** 202,220 ****
  408.   #endif
  409.           if (pipe(pipefd) < 0)
  410.               exit(EX_OSERR);
  411. !         if (fork() == 0) {
  412.               /*
  413.                * Child: send the message down the pipe. 
  414.                */
  415.               FILE *out;
  416.   
  417.               out = fdopen(pipefd[1], "w");
  418.               close(pipefd[0]);
  419. !             fputs(lbuf, out);
  420.               while (fgets(lbuf, sizeof lbuf, stdin))
  421.                   fputs(lbuf, out);
  422.               (void) fclose(out);
  423.               exit(EX_OK);
  424.           }
  425.           /*
  426.            * Parent: call sendmail with pipe as standard input 
  427. --- 300,329 ----
  428.   #endif
  429.           if (pipe(pipefd) < 0)
  430.               exit(EX_OSERR);
  431. !         switch (fork()) {
  432. !         case -1:
  433. !             exit(EX_OSERR);
  434. !         /*NOTREACHED*/
  435. !         case 0:
  436.               /*
  437.                * Child: send the message down the pipe. 
  438.                */
  439. +             {
  440.               FILE *out;
  441.   
  442.               out = fdopen(pipefd[1], "w");
  443.               close(pipefd[0]);
  444. !             fputs(from_lines, out);
  445. !             lbuf = (char *)xrealloc(lbuf, BUFSIZ+1);
  446.               while (fgets(lbuf, sizeof lbuf, stdin))
  447.                   fputs(lbuf, out);
  448.               (void) fclose(out);
  449.               exit(EX_OK);
  450. +             }
  451. +         /*NOTREACHED*/
  452. +         default:
  453. +             /*parent*/
  454. +         break;
  455.           }
  456.           /*
  457.            * Parent: call sendmail with pipe as standard input 
  458. ***************
  459. *** 221,228 ****
  460.            */
  461.           close(pipefd[1]);
  462.           dup2(pipefd[0], 0);
  463. !     }
  464.       execv(_PATH_SENDMAIL, args);
  465.       fprintf(stderr, "Exec of %s failed!\n", _PATH_SENDMAIL);
  466. !     exit(EX_OSERR);
  467.   }
  468. --- 330,406 ----
  469.            */
  470.           close(pipefd[1]);
  471.           dup2(pipefd[0], 0);
  472. !     } else
  473. !         rewind(stdin);
  474. ! #ifdef DEBUG
  475. !     if (Debug)
  476. !         execl("/bin/cat", "cat", "-", (char *)NULL);
  477. !     else
  478. ! #endif
  479.       execv(_PATH_SENDMAIL, args);
  480.       fprintf(stderr, "Exec of %s failed!\n", _PATH_SENDMAIL);
  481. !     return(EX_OSERR);
  482. ! }
  483. ! #ifndef    HAVE_STRDUP
  484. ! char    *strdup(s)
  485. ! char    *s;
  486. ! {
  487. !     char    *dup;
  488. !     dup = (char *)xmalloc(strlen(s)+1);
  489. !     if (dup) {
  490. !         strcpy(dup, s);
  491. !     }
  492. !     return(dup);
  493. ! }
  494. ! #endif
  495. ! #define    RETRIES    5
  496. ! #define    WAIT_TIME    5
  497. ! char    *xmalloc(size)
  498. ! unsigned    size;
  499. ! {
  500. !     register    char    *ret;
  501. !     register    int    i = 0;
  502. !     while ((ret = (char *)malloc(size)) == (char *)NULL)
  503. !         if (i++ > RETRIES) {
  504. !             fprintf(stderr, "rmail: no memory\n");
  505. !             exit(EX_OSERR);
  506. !         } else
  507. !             sleep(WAIT_TIME);
  508. !     return(ret);
  509. ! }
  510. ! char    *xrealloc(cp, size)
  511. ! char    *cp;
  512. ! unsigned    size;
  513. ! {
  514. !     register    char    *ret;
  515. !     register    int    i = 0;
  516. !     while ((ret = (char *)realloc(cp, size)) == (char *)NULL)
  517. !         if (i++ > RETRIES) {
  518. !             fprintf(stderr, "rmail: no memory\n");
  519. !             exit(EX_OSERR);
  520. !         } else
  521. !             sleep(WAIT_TIME);
  522. !     return(ret);
  523. ! }
  524. ! char    *xcalloc(nelem, elsize)
  525. ! unsigned    nelem,    elsize;
  526. ! {
  527. !     register    char    *ret;
  528. !     register    int    i = 0;
  529. !     while ((ret = (char *)calloc(nelem, elsize)) == (char *)NULL)
  530. !         if (i++ > RETRIES) {
  531. !             fprintf(stderr, "rmail: no memory\n");
  532. !             exit(EX_OSERR);
  533. !         } else
  534. !             sleep(WAIT_TIME);
  535. !     return(ret);
  536.   }
  537. *** mailstats/Makefile.3b1
  538. --- mailstats/Makefile.3b1
  539. ***************
  540. *** 0 ****
  541. --- 1,17 ----
  542. + #    @(#)Makefile    5.1 (Berkeley) 5/11/90
  543. + all: mailstats
  544. + include    /u/bruce/Makefile
  545. + CC = gcc
  546. + CFLAGS= -g -O -I/usr/local/lib/gcc-include -I/usr/ethernet/include -I../src -I../support -DSYSTEM5 -DLIBC_SCCS -DSCANF -fcombine-regs -fstrength-reduce -fpcc-struct-return -Wall
  547. + PROG=    mailstats
  548. + LDFLAGS = -s
  549. + mailstats.o: pathnames.h ../src/mailstats.h
  550. + mailstats: mailstats.o
  551. +     $(LD) $(LDFLAGS) -o mailstats /lib/crt0s.o mailstats.o /lib/shlib.ifile
  552. *** mailstats/mailstats.c
  553. --- mailstats/mailstats.c
  554. ***************
  555. *** 1,3 ****
  556. --- 1,4 ----
  557. + /*    %W%    %G%    %U%    */
  558.   /*
  559.    * Copyright (c) 1983 Eric P. Allman
  560.    * Copyright (c) 1988 Regents of the University of California.
  561. ***************
  562. *** 26,32 ****
  563.   #endif /* not lint */
  564.   
  565.   #ifndef lint
  566. ! static char sccsid[] = "@(#)mailstats.c    5.7 (Berkeley) 6/1/90";
  567.   #endif /* not lint */
  568.   
  569.   #include <sys/file.h>
  570. --- 27,36 ----
  571.   #endif /* not lint */
  572.   
  573.   #ifndef lint
  574. ! static char sccsid[] = "@(#)mailstats.c    5.7 (Berkeley) 6/1/90    %I% local";
  575. ! #ifdef    __GNUC__
  576. ! static    char    compiled[] = "%Z%compiled by gcc version "__VERSION__;
  577. ! #endif
  578.   #endif /* not lint */
  579.   
  580.   #include <sys/file.h>
  581. ***************
  582. *** 34,39 ****
  583. --- 38,44 ----
  584.   #include <mailstats.h>
  585.   #include "pathnames.h"
  586.   
  587. + int
  588.   main(argc, argv)
  589.       int argc;
  590.       char **argv;
  591. ***************
  592. *** 74,81 ****
  593.       printf(" M msgsfr bytes_from  msgsto   bytes_to\n");
  594.       for (i = 0; i < MAXMAILERS; i++)
  595.           if (stat.stat_nf[i] || stat.stat_nt[i])
  596. !             printf("%2d %6ld %10ldK %6ld %10ldK\n", i,
  597.                   stat.stat_nf[i], stat.stat_bf[i],
  598.                   stat.stat_nt[i], stat.stat_bt[i]);
  599. !     exit(0);
  600.   }
  601. --- 79,86 ----
  602.       printf(" M msgsfr bytes_from  msgsto   bytes_to\n");
  603.       for (i = 0; i < MAXMAILERS; i++)
  604.           if (stat.stat_nf[i] || stat.stat_nt[i])
  605. !             printf("%2d %6lu %10lu  %6lu %10lu\n", i,
  606.                   stat.stat_nf[i], stat.stat_bf[i],
  607.                   stat.stat_nt[i], stat.stat_bt[i]);
  608. !     return(0);
  609.   }
  610.